<template>
  <div>
    <div id="nav">
      <router-link to="/home"
        ><b-icon icon="chevron-left"></b-icon>返回</router-link
      >
    </div>
    <b-card border-variant="light" header="景区列表" align="left">
      <div class="list" v-for="item in list" :key="item.gid">
        <img :src="'scenery/' + item.gid + '.jpg'" alt="image" id="img" />
        <div id="attr">
          <h5>
            <b>{{ item.name }}</b>
          </h5>
          <p>地址:{{ item.address }}</p>
          <p>景区等级:{{ item.grade }}级</p>
        </div>
      </div>
    </b-card>
  </div>
</template>

<script>
import bus from "../../eventBus.js";
export default {
  name: "sceneryAtt",
  data() {
    return {
      list: [],
    };
  },
  props: [],
  beforeCreate() {},
  created() {
    bus.$on("shareScenery", (val) => {
      if (this.list.length != 0) {
        this.list = [];
      }
      this.$set(this.list, 0, val);
    });
    bus.$on("sceneryRes", (val) => {
      if (this.list.length != 0) {
        this.list = [];
      }
      this.list = val;
    });
  },
  methods: {},
};
</script>

<style scoped>
#nav {
  width: 100%;
  padding-left: 5px;
  padding-top: 2px;
}

a {
  text-decoration: none;
  color: white;
  font-size: 20px;
}
a:hover {
  text-decoration: none;
  color: blue;
}
p {
  margin: 0;
  padding: 0;
  font-size: 90%;
}
.list {
  display: flex;
  padding: 2px;
}
#img {
  width: 40%;
  padding: 2px;
}
</style>